#!/usr/bin/python

import time, sys
from math import sqrt, ceil, floor

def hyp(a, b):
    c = sqrt((a * a) + (b * b))
    return c

def main():
    """ 
    A Pythagorean triplet is a set of three natural numbers, a < b < c, 
    
    for which, a2 + b2 = c2
    For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2
        
    There exists exactly one Pythagorean triplet for which a + b + c = 1000.
    Find the product a + b + c
    
    """
    start = time.time()
    
    for a in xrange(1, 500):
        for b in xrange(a, 500):
            c = hyp(a, b)
            # print '{0} {1} {2:.2f}'.format(a, b, c),
            sum = a + b + c
            if sum == 1000:
                print 'we got a weener'
                x = a
                y = b
                z = c
                # print '{0:.2f} s'.format(time.time() - start)        
                break
            # elif sum < 1001:
                # print '{0:.2f}'.format(sum)
            elif sum > 1000:
                # print 'bust'
                break
    
    if x:
        print 'winner! :', x, y, z   #   a = 200, b = 375, c = 425
        
    print '{0:.2f} s'.format(time.time() - start)        


if __name__ == '__main__':
  main()
